<div class="related-posts">
    <h3 id="相关文章">相关文章</h3>
    {% assign maxRelated = 5 %}
    {% assign minCommonTags = 1 %}
    {% assign maxRelatedCounter = 0 %}
    <ul>
        {% for post in site.posts %}
            {% assign sameTagCount = 0 %}
            {% assign commonTags = '' %}
            {% for tag in post.tags %}
                {% if post.url != page.url %}
                    {% if page.tags contains tag %}
                        {% assign sameTagCount = sameTagCount | plus: 1 %}
                        <!-- {% capture tagmarkup %} <span class="label label-default">{{ tag }}</span> {% endcapture %}
                            {% assign commonTags = commonTags | append: tagmarkup %} -->
                    {% endif %}
                {% endif %}
            {% endfor %}
            {% if sameTagCount >= minCommonTags %}
                <li>
                    {{post.date | date: '%F'}} -<a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a>
                </li>
            {% assign maxRelatedCounter = maxRelatedCounter | plus: 1 %}
                {% if maxRelatedCounter >= maxRelated %}
                    {% break %}
                {% endif %}
            {% endif %}
        {% endfor %}
    </ul>
</div>